<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link href="__PUBLIC__/admin/sncss/css/style.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="__PUBLIC__/admin/sncss/css/timeselector.css">

</head>

<body>

	<div class="place">
		<span>位置：</span>
		<ul class="placeul">
		<li><a>首页</a></li>
		<li><a>主播管理</a></li>
		<li><a>认证列表</a></li>
		</ul>
		</div>

		<div class="formbody">

		<div class="formtitle"><span>主播信息</span></div>
			<form id="formid" name="form1" method="post" action="{:U('/Home/Audit/edit_approve')}" onsubmit="return form1_submit();">
		<input name="did"  type="hidden" class="dfinput" value="{$authentication['id']}" />
		<input name="uuid"  type="hidden" class="dfinput" value="{$member['uuid']}" />
		<ul class="forminfo">
		<li><label>用户编号</label><input type="text" class="dfinput" value="{$member['uuid']}" disabled /><i></i></li>
		<li><label>昵称</label><input type="text" class="dfinput" value="{$member['nickname']}" disabled /><i></i></li>
		<li><label>手机号</label><input type="text" class="dfinput" value="{$member['username']}" disabled /><i></i></li>
		<li><label>真实姓名</label><input type="text" class="dfinput" value="{$authentication['name']}" disabled /><i></i></li>
		<li><label>联系地址</label><input type="text" class="dfinput" value="{$authentication['city']}" disabled /><i></i></li>
		<li><label>录音场所</label>
			<switch name="authentication['place']" >
			<case value="0"><label>家用电脑</label></case>
			<case value="1"><label>专业录音棚</label></case>
			<default />未知
			</switch>
		<li><label>认证音频</label><label><audio src="<?php echo $authentication['musiclink'];?>" controls="controls">您的浏览器不支持 audio 标签。</audio></label><i></i></li>


		<li>
		<label>签约时段</label>
		<span style="line-height: 34px;display: block;float: left;">
		{$authentication['time']}
			<!-- <div id="parente">
				<div class="form-container _grid-container col-sm-offset-3 ">
					<div class="axis-y"></div>
					<div class="opt-area">
						<div class="grid-layer"></div>
						<div class="value-layer"></div>
						<div class="cursor-layer"></div>
						<div class="drag-layer"></div>
					</div>
					<div class="axis-x"></div>
				</div>
			</div> -->
		</span></li>
		<li><label>兑换价格</label><input name="proportion" id="proportion" type="text" class="sminput" style="width: 60px;" value="{$member['proportion']}" onkeyup="this.value=this.value.replace(/[^\d]/g,'');" />元/小时</li>
		<li><label>&nbsp;</label><label>&nbsp;</label></li>
		<li><label>&nbsp;</label>
		<if condition="$founder neq 3">
		<input type="submit" class="btn" value="修改价格"/>
		</if>
		<!--<a href="{:U('/Home/Daochu/index')}" class="btn" style="border:none;width:100px;height:40px; font-size:14px; cursor:pointer; line-height:40px;background:#61afdf;color:#fff;text-align:center;text-indent:0;display:block;float: left;margin-left: 5px;">取消认证</a>-->
		 <input type="button" class="btn" href="javascript:void(0);" id="inside" value="取消认证"/>
		</li>
		<li>
		<label>签约自媒体</label>
		<span style="line-height: 34px;display: block;float: left;">
		<?php if(empty($medianamearr)){?>
		<?php echo "未签约";}else{echo $medianamearr;}?>
		</span></li>
		</ul>
			</form>

		</div>
<style type="text/css">
.mainlist{padding:10px;}
</style>
</body>
<script src="__PUBLIC__/js/jquery1.8.3.js"></script>
<script src="__PUBLIC__/layer/layer.js"></script>
<script src="__PUBLIC__/checkbox/js/input.js"></script>

<script type="text/javascript">
$("#inside").click(function(){
		layer.open({title: false, type: 1, area: ['600px', '300px'], //宽高
				content: '<div class="mainlist"><form id="form2" name="form2" method="post" action="/Home/Audit/dismissal" onsubmit="return form2_submit();">'
				+'<br><br><textarea class="textinput" name="approve_message" id="approve_message"></textarea>'
				+'<input name="did"  type="hidden" class="dfinput" value="{$authentication[id]}" />'
				+'<input name="uuid"  type="hidden" class="dfinput" value="{$member[uuid]}" />'
				+'<input name="submit_type" type="submit" class="btn" value="认证驳回"/></form></div>'
		});
});
</script>
<script type="text/javascript">

		function form2_submit(){
				var approve_message= $('#approve_message').val();
				if(approve_message.length==0){
						layer.msg('必须填写理由');return false;
				}
		}
</script>
<script>
function TableSelector($container, axisY, axisX) {
	this.axisX = axisX;
	this.axisY = axisY;
	this.dataSet = [];
	this.contentWidth = 20;
	this.borderWidth = 21;
	var that = this;
	var axisXElem = '',
		axisYElem = '',
		gridsElem = '';
	var status = 1; // 鼠标动作 0 无 1 激活单元格 2 选区
	for (var i = 0; i < axisY.length; i++) {
		//- this.dataSet
		this.dataSet[i] = [];
		for (var j = 0; j < axisX.length; j++) {
			this.dataSet[i].push(0);
			gridsElem += '<div class="grid"></div>';
		}
	}
	for (var m = 0; m < axisX.length; m++) {
		axisXElem += '<div class="title">' + axisX[m] + '</div>';
	}
	for (var n = 0; n < axisY.length; n++) {
		axisYElem += '<div class="title">' + axisY[n] + '</div>';
	}

	$container.find('.grid-layer').html(gridsElem);
	$container.find('.axis-x').html(axisXElem);
	$container.find('.axis-y').html(axisYElem);
	var $optArea = $container.find(".opt-area"),
		$cursorLyr = $container.find('.cursor-layer'),
		$valLyr = $container.find('.value-layer'),
		$body = $('body');
	function setDataSet (x, y, width, height, value) {
		for (var i = 0; i < height; i++) {
			for (var j = 0; j < width; j++) {
				that.dataSet[y + i][x + j] = value;
			}
		}
		redrawValueLyr();
	}
	function redrawValueLyr() {
		var count = 0;
		var html = '', top = 0, left = 0, width = 0, height = 0, val
		for (var i=0; i < axisY.length; i++) {
			for (var j=0; j < axisX.length; j++) {
				if (that.dataSet[i][j] === 1) {
					count++;
					top = that.borderWidth * i + 1, left = that.borderWidth * j + 1;
					html += "<span style='top:" + top + "px;left:" + left + "px;'></span>";
				}
			}
		}
		// var allIncome = getAllIncome(unitIncome, count);
		// $('#income').text(allIncome);
		$valLyr.empty().append(html);
	}
	// 根据相对坐标获取单元格左上角坐标
	function getTopLeftCoor(x, y) {
		return [x - x % that.borderWidth > 0 ? x - x % that.borderWidth : 0, y - y % that.borderWidth > 0 ? y - y % that.borderWidth : 0];
	}
	// 根据相对坐标获取单元格右下角坐标
	function getBottomRightCoor(x, y) {
		return [x - x % that.borderWidth + that.contentWidth < $optArea.width() - 1 ? x - x % that.borderWidth + that.contentWidth : $optArea.width() -2,
			y - y % that.borderWidth + that.contentWidth < $optArea.height()-1 ? y - y % that.borderWidth + that.contentWidth : $optArea.height() -2];
	}
	// 设置选中区域
	function setSelectArea(offsetTop, offsetLeft, width, height) {
		$cursorLyr.show().css({
			top: offsetTop,
			left: offsetLeft,
			width: width,
			height: height
		})
	}

	// 确认弹层
	var confirmLyrHandler = {
		html: `
			<div class="option-layer">
				<div class="title"><span class="time"></span>的接单意向为：</div>
				<div class="selector">
						<label for="opt-confirm">
								<input type="radio" id="opt-confirm" name="opt-selector" value='1' checked/>
								可接单并交付
						</label>
						<label for="opt-cancel">
								<input type="radio" id="opt-cancel" name="opt-selector" value='0'/>
								不可接单
						</label>
				</div>
				<div class="btn-container">
					<a href="#" class="btn btn-confirm">确认</a>
					<a href="#" class="btn btn-cancel">取消</a>
				</div>
				</div>`,
		show: function (x, y) {
			var _this = this;
			$('body').find('.option-layer').remove();
			$('body').append(_this.html);
			$('body > .option-layer').css({
				top: y,
				left: x
			});
			var width = Math.ceil((parseInt($cursorLyr.css('width')) + 1) / that.borderWidth),
				height = (parseInt($cursorLyr.css('height')) + 1) / that.borderWidth,
				indexX = parseInt($cursorLyr.css('left')) / that.borderWidth,
				indexY = parseInt($cursorLyr.css('top')) / that.borderWidth;
			console.log(width, height, indexX, indexY);
			var text = '';
			if (height > 1) {
				text = axisY[indexY] + ' - ' + axisY[indexY + height - 1];
			} else {
				text = axisY[indexY];
			}
			if (width > 1) {
				if (indexX + width == 24) {
					text += ' ' + axisX[indexX] + ' - ' + '24:00';
				} else {
					text += ' ' + axisX[indexX] + ' - ' + axisX[indexX + width];
				}
			} else {
				if (indexX + 1 == 24) {
					text += ' ' + axisX[indexX] + ' - ' + '24:00';
				} else {
					console.log(123123231, indexX);
					text += ' ' + axisX[indexX] + ' - ' + axisX[indexX + 1];
				}
			}
			$('body > .option-layer .time').text(text);
			// 绑定事件
			$('body .option-layer .btn.btn-confirm').on('click', function (ev) {
				if ($('body .option-layer').find('input[type="radio"]:checked').val() == 1) {
						// 确定
						setDataSet(indexX, indexY, width, height, 1);
						// 计算
				} else {
						// 取消
						setDataSet(indexX, indexY, width, height, 0);
				}
				ev.preventDefault();
				ev.stopPropagation();
				$cursorLyr.removeClass('cursor-layer-active').hide();
				status = 1;
				_this.hide();
			})
			$('body .option-layer .btn.btn-cancel').on('click', function (ev) {
				ev.preventDefault();
				ev.stopPropagation();
				$cursorLyr.removeClass('cursor-layer-active').hide();
				status = 1;
				_this.hide();
			})
		},
		hide: function () {
			$('body .option-layer').remove();
		}
	}
	var mdownX, mdownY, mupX, mupY, layerLock = true;
	var optOffsetY1, optOffsetX1, optOffsetY2, optOffsetX2;
	$body.on('mousemove', function (e) {
		// 判断是否在开始选中区域操作
		// if ($optArea.offset())
		if (status === 1) {
			// 判断是否在指定区域内
			optOffsetY1 = $optArea.offset().top,
			optOffsetX1 = $optArea.offset().left,
			optOffsetY2 = optOffsetY1 + $optArea.height(),
			optOffsetX2 = optOffsetX1 + $optArea.width();
			if (e.pageX >= optOffsetX1 && e.pageX <= optOffsetX2 && e.pageY >=optOffsetY1 && e.pageY <= optOffsetY2) {
				var offsetX = e.pageX - optOffsetX1,
					offsetY = e.pageY - optOffsetY1;
				if (offsetX / that.borderWidth >= axisX.length) {
					offsetX -= 2;
				}
				if (offsetY / that.borderWidth >= axisY.length) {
					offsetY -= 2;
				}
				// 显示单元格
				setSelectArea(offsetY - offsetY % that.borderWidth, offsetX - offsetX % that.borderWidth, that.contentWidth, that.contentWidth);
			} else {
				$cursorLyr.hide();
			}
		} else if (status === 2) {
				optOffsetY1 = $optArea.offset().top,
				optOffsetX1 = $optArea.offset().left,
				optOffsetY2 = optOffsetY1 + $optArea.height(),
				optOffsetX2 = optOffsetX1 + $optArea.width();

			var offsetX = e.pageX - optOffsetX1,
				offsetY = e.pageY - optOffsetY1;
			if (offsetX / that.borderWidth >= axisX.length) {
				offsetX -= 2;
			}
			if (offsetY / that.borderWidth >= axisY.length) {
				offsetY -= 2;
			}
			// 做边界处理
			var topLeftCoor = getTopLeftCoor(Math.min(mdownX, offsetX), Math.min(mdownY, offsetY)),
				bottomRightCoor = getBottomRightCoor(Math.max(mdownX, offsetX), Math.max(mdownY, offsetY));
			// 显示选中区域
			setSelectArea(topLeftCoor[1], topLeftCoor[0],
										bottomRightCoor[0] - topLeftCoor[0],
										bottomRightCoor[1] - topLeftCoor[1]);
		}
	})

	$container.find('._grid-container .opt-area').on('mousedown', function (ev) {
		//- drag start
		//- var topLeftCoor = getTopLeftCoor(e.offsetX, e.offsetY);
		ev.preventDefault();
		ev.stopPropagation();
		if (status !== 0) {
			mdownX = ev.offsetX, mdownY = ev.offsetY;
			status = 2;
			$cursorLyr.addClass('cursor-layer-active').show();
		}

	})
	$body.on('mouseup', function (ev) {
		//- drag end
		if (status === 2) {
			status = 0;
			mupX = ev.offsetX, mupY = ev.offsetY;
			var cursorLyrOffsetTop = parseInt($cursorLyr.css('top')),
				cursorLyrOffsetLeft = parseInt($cursorLyr.css('left'));
			//- console.log(cursorLyrOffsetTop, cursorLyrOffsetLeft, optOffsetX1, optOffsetY1, $cursorLyr.height())
			confirmLyrHandler.show(optOffsetX1 + cursorLyrOffsetLeft , optOffsetY1 + cursorLyrOffsetTop + $cursorLyr.height());
		}
		//- 显示弹出框
	})
}
//- TableSelector.prototype.
var timeSelector = new TableSelector($('#parente'),
	['全天'],
	["0:00", "1:00", "2:00", "3:00", "4:00", "5:00", "6:00", "7:00", "8:00", "9:00", "10:00", "11:00", "12:00",
	"13:00", "14:00", "15:00", "16:00", "17:00", "18:00", "19:00", "20:00", "21:00", "22:00", "23:00"]);


/*--------------------------------------------------------*/

function TableSelector($container, axisY, axisX) {
  this.axisX = axisX;
  this.axisY = axisY;
  this.dataSet = [];
  this.contentWidth = 20;
  this.borderWidth = 21;
  var that = this;
  var axisXElem = '',
    axisYElem = '',
    gridsElem = '';
  var status = 1; // 鼠标动作 0 无 1 激活单元格 2 选区
  for (var i = 0; i < axisY.length; i++) {
    //- this.dataSet
    this.dataSet[i] = [];
    for (var j = 0; j < axisX.length; j++) {
      this.dataSet[i].push(0);
      gridsElem += '<div class="grid"></div>';
    }
  }
  for (var m = 0; m < axisX.length; m++) {
    axisXElem += '<div class="title">' + axisX[m] + '</div>';
  }
  for (var n = 0; n < axisY.length; n++) {
    axisYElem += '<div class="title">' + axisY[n] + '</div>';
  }

  $container.find('.grid-layer').html(gridsElem);
  $container.find('.axis-x').html(axisXElem);
  $container.find('.axis-y').html(axisYElem);
  var $optArea = $container.find(".opt-area"),
    $cursorLyr = $container.find('.cursor-layer'),
    $valLyr = $container.find('.value-layer'),
    $body = $('body');
  function setDataSet (x, y, width, height, value) {
    for (var i = 0; i < height; i++) {
      for (var j = 0; j < width; j++) {
        that.dataSet[y + i][x + j] = value;
      }
    }
    redrawValueLyr();
  }
  function redrawValueLyr() {
    var count = 0;
    var html = '', top = 0, left = 0, width = 0, height = 0, val
    for (var i=0; i < axisY.length; i++) {
      for (var j=0; j < axisX.length; j++) {
        if (that.dataSet[i][j] === 1) {
          count++;
          top = that.borderWidth * i + 1, left = that.borderWidth * j + 1;
          html += "<span style='top:" + top + "px;left:" + left + "px;'></span>";
        }
      }
    }
    if (count > 0) {
        $('#last_btn button').addClass('register_complate_btn_go');
    } else {
        $('#last_btn button').removeClass('register_complate_btn_go');
    }

    $valLyr.empty().append(html);
  }
  // 根据相对坐标获取单元格左上角坐标
  function getTopLeftCoor(x, y) {
    return [x - x % that.borderWidth > 0 ? x - x % that.borderWidth : 0, y - y % that.borderWidth > 0 ? y - y % that.borderWidth : 0];
  }
  // 根据相对坐标获取单元格右下角坐标
  function getBottomRightCoor(x, y) {
    return [x - x % that.borderWidth + that.contentWidth < $optArea.width() - 1 ? x - x % that.borderWidth + that.contentWidth : $optArea.width() -2,
      y - y % that.borderWidth + that.contentWidth < $optArea.height()-1 ? y - y % that.borderWidth + that.contentWidth : $optArea.height() -2];
  }
  // 设置选中区域
  function setSelectArea(offsetTop, offsetLeft, width, height) {
    $cursorLyr.show().css({
      top: offsetTop,
      left: offsetLeft,
      width: width,
      height: height
    })
  }

  // 确认弹层
  var confirmLyrHandler = {
    html: `
      <div class="option-layer">
        <div class="title"><span class="time"></span>的接单意向为：</div>
        <div class="selector">
            <label for="opt-confirm">
                <input type="radio" id="opt-confirm" name="opt-selector" value='1' checked/>
                可接单并交付
            </label>
            <label for="opt-cancel">
                <input type="radio" id="opt-cancel" name="opt-selector" value='0'/>
                不可接单
            </label>
        </div>
        <div class="btn-container">
          <a href="#" class="btn btn-confirm">确认</a>
          <a href="#" class="btn btn-cancel">取消</a>
        </div>
        </div>`,
    show: function (x, y) {
      var _this = this;
      $('body').find('.option-layer').remove();
      $('body').append(_this.html);
      $('body > .option-layer').css({
        top: y,
        left: x
      });
      var width = Math.ceil((parseInt($cursorLyr.css('width')) + 1) / that.borderWidth),
        height = (parseInt($cursorLyr.css('height')) + 1) / that.borderWidth,
        indexX = parseInt($cursorLyr.css('left')) / that.borderWidth,
        indexY = parseInt($cursorLyr.css('top')) / that.borderWidth;
      console.log(width, height, indexX, indexY);
      var text = '';
      if (height > 1) {
        text = axisY[indexY] + ' - ' + axisY[indexY + height - 1];
      } else {
        text = axisY[indexY];
      }
      if (width > 1) {
        if (indexX + width == 24) {
          text += ' ' + axisX[indexX] + ' - ' + '24:00';
        } else {
          text += ' ' + axisX[indexX] + ' - ' + axisX[indexX + width];
        }
      } else {
        if (indexX + 1 == 24) {
          text += ' ' + axisX[indexX] + ' - ' + '24:00';
        } else {
          console.log(123123231, indexX);
          text += ' ' + axisX[indexX] + ' - ' + axisX[indexX + 1];
        }
      }
      $('body > .option-layer .time').text(text);
      // 绑定事件
      $('body .option-layer .btn.btn-confirm').on('click', function (ev) {
        if ($('body .option-layer').find('input[type="radio"]:checked').val() == 1) {
            // 确定
            setDataSet(indexX, indexY, width, height, 1);
            // 计算
        } else {
            // 取消
            setDataSet(indexX, indexY, width, height, 0);
        }
        ev.preventDefault();
        ev.stopPropagation();
        $cursorLyr.removeClass('cursor-layer-active').hide();
        status = 1;
        _this.hide();
      })
      $('body .option-layer .btn.btn-cancel').on('click', function (ev) {
        ev.preventDefault();
        ev.stopPropagation();
        $cursorLyr.removeClass('cursor-layer-active').hide();
        status = 1;
        _this.hide();
      })
    },
    hide: function () {
      $('body .option-layer').remove();
    }
  }
  var mdownX, mdownY, mupX, mupY, layerLock = true;
  var optOffsetY1, optOffsetX1, optOffsetY2, optOffsetX2;
  $body.on('mousemove', function (e) {
    // 判断是否在开始选中区域操作
    // if ($optArea.offset())
    if (status === 1) {
      // 判断是否在指定区域内
      optOffsetY1 = $optArea.offset().top,
      optOffsetX1 = $optArea.offset().left,
      optOffsetY2 = optOffsetY1 + $optArea.height(),
      optOffsetX2 = optOffsetX1 + $optArea.width();
      if (e.pageX >= optOffsetX1 && e.pageX <= optOffsetX2 && e.pageY >=optOffsetY1 && e.pageY <= optOffsetY2) {
        var offsetX = e.pageX - optOffsetX1,
          offsetY = e.pageY - optOffsetY1;
        if (offsetX / that.borderWidth >= axisX.length) {
          offsetX -= 2;
        }
        if (offsetY / that.borderWidth >= axisY.length) {
          offsetY -= 2;
        }
        // 显示单元格
        setSelectArea(offsetY - offsetY % that.borderWidth, offsetX - offsetX % that.borderWidth, that.contentWidth, that.contentWidth);
      } else {
        $cursorLyr.hide();
      }
    } else if (status === 2) {
        optOffsetY1 = $optArea.offset().top,
        optOffsetX1 = $optArea.offset().left,
        optOffsetY2 = optOffsetY1 + $optArea.height(),
        optOffsetX2 = optOffsetX1 + $optArea.width();

      var offsetX = e.pageX - optOffsetX1,
        offsetY = e.pageY - optOffsetY1;
      if (offsetX / that.borderWidth >= axisX.length) {
        offsetX -= 2;
      }
      if (offsetY / that.borderWidth >= axisY.length) {
        offsetY -= 2;
      }
      // 做边界处理
      var topLeftCoor = getTopLeftCoor(Math.min(mdownX, offsetX), Math.min(mdownY, offsetY)),
        bottomRightCoor = getBottomRightCoor(Math.max(mdownX, offsetX), Math.max(mdownY, offsetY));
      // 显示选中区域
      setSelectArea(topLeftCoor[1], topLeftCoor[0],
                    bottomRightCoor[0] - topLeftCoor[0],
                    bottomRightCoor[1] - topLeftCoor[1]);
    }
  })

  $container.find('._grid-container .opt-area').on('mousedown', function (ev) {
    //- drag start
    //- var topLeftCoor = getTopLeftCoor(e.offsetX, e.offsetY);
    ev.preventDefault();
    ev.stopPropagation();
    if (status !== 0) {
      mdownX = ev.offsetX, mdownY = ev.offsetY;
      status = 2;
      $cursorLyr.addClass('cursor-layer-active').show();
    }

  })
  $body.on('mouseup', function (ev) {
    //- drag end
    if (status === 2) {
      status = 0;
      mupX = ev.offsetX, mupY = ev.offsetY;
      var cursorLyrOffsetTop = parseInt($cursorLyr.css('top')),
        cursorLyrOffsetLeft = parseInt($cursorLyr.css('left'));
      //- console.log(cursorLyrOffsetTop, cursorLyrOffsetLeft, optOffsetX1, optOffsetY1, $cursorLyr.height())
      confirmLyrHandler.show(optOffsetX1 + cursorLyrOffsetLeft , optOffsetY1 + cursorLyrOffsetTop + $cursorLyr.height());
    }
    //- 显示弹出框
  })
}
//- TableSelector.prototype.
var timeSelector = new TableSelector($('#parente'),
  ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
  ["0:00", "1:00", "2:00", "3:00", "4:00", "5:00", "6:00", "7:00", "8:00", "9:00", "10:00", "11:00", "12:00",
  "13:00", "14:00", "15:00", "16:00", "17:00", "18:00", "19:00", "20:00", "21:00", "22:00", "23:00"]);
</script>
</html>
